package com.ruoyi.web.controller.supervise;

import java.util.List;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.supervise.domain.ConsturctionChangeInfoList;
import com.ruoyi.supervise.service.IConsturctionChangeInfoListService;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 施工许可证修改记录列Controller
 * 
 * @author wtj
 * @date 2019-10-15
 */
@Controller
@RequestMapping("/supervise/ConsturctionChangeInfoList")
public class ConsturctionChangeInfoListController extends BaseController
{
    private String prefix = "supervise/ConsturctionChangeInfoList";

    @Autowired
    private IConsturctionChangeInfoListService consturctionChangeInfoListService;

    @RequiresPermissions("supervise:ConsturctionChangeInfoList:view")
    @GetMapping()
    public String ConsturctionChangeInfoList()
    {
        return prefix + "/ConsturctionChangeInfoList";
    }

    /**
     * 查询施工许可证修改记录列列表
     */
    @RequiresPermissions("supervise:ConsturctionChangeInfoList:list")
    @PostMapping("/list")
    @ResponseBody
    public TableDataInfo list(ConsturctionChangeInfoList consturctionChangeInfoList)
    {
        startPage();
        List<ConsturctionChangeInfoList> list = consturctionChangeInfoListService.selectConsturctionChangeInfoListList(consturctionChangeInfoList);
        return getDataTable(list);
    }

    /**
     * 导出施工许可证修改记录列列表
     */
    @RequiresPermissions("supervise:ConsturctionChangeInfoList:export")
    @PostMapping("/export")
    @ResponseBody
    public AjaxResult export(ConsturctionChangeInfoList consturctionChangeInfoList)
    {
        List<ConsturctionChangeInfoList> list = consturctionChangeInfoListService.selectConsturctionChangeInfoListList(consturctionChangeInfoList);
        ExcelUtil<ConsturctionChangeInfoList> util = new ExcelUtil<ConsturctionChangeInfoList>(ConsturctionChangeInfoList.class);
        return util.exportExcel(list, "ConsturctionChangeInfoList");
    }

    /**
     * 新增施工许可证修改记录列
     */
    @GetMapping("/add")
    public String add()
    {
        return prefix + "/add";
    }

    /**
     * 新增保存施工许可证修改记录列
     */
    @RequiresPermissions("supervise:ConsturctionChangeInfoList:add")
    @Log(title = "施工许可证修改记录列", businessType = BusinessType.INSERT)
    @PostMapping("/add")
    @ResponseBody
    public AjaxResult addSave(ConsturctionChangeInfoList consturctionChangeInfoList)
    {
        return toAjax(consturctionChangeInfoListService.insertConsturctionChangeInfoList(consturctionChangeInfoList));
    }

    /**
     * 修改施工许可证修改记录列
     */
    @GetMapping("/edit/{modifiedpersonloginname}")
    public String detail(@PathVariable("modifiedpersonloginname") String modifiedpersonloginname, ModelMap mmap)
    {
        ConsturctionChangeInfoList consturctionChangeInfoList = consturctionChangeInfoListService.selectConsturctionChangeInfoListById(modifiedpersonloginname);
        mmap.put("consturctionChangeInfoList", consturctionChangeInfoList);
        return prefix + "/edit";
    }

    /**
     * 修改保存施工许可证修改记录列
     */
    @RequiresPermissions("supervise:ConsturctionChangeInfoList:edit")
    @Log(title = "施工许可证修改记录列", businessType = BusinessType.UPDATE)
    @PostMapping("/edit")
    @ResponseBody
    public AjaxResult editSave(ConsturctionChangeInfoList consturctionChangeInfoList)
    {
        return toAjax(consturctionChangeInfoListService.updateConsturctionChangeInfoList(consturctionChangeInfoList));
    }
    
    /**
     * 施工许可证修改记录详情
     */
    @GetMapping("/detail/{modifiedpersonloginname}")
    public String edit(@PathVariable("modifiedpersonloginname") String modifiedpersonloginname, ModelMap mmap)
    {
        ConsturctionChangeInfoList consturctionChangeInfoList = consturctionChangeInfoListService.selectConsturctionChangeInfoListById(modifiedpersonloginname);
        mmap.put("consturctionChangeInfoList", consturctionChangeInfoList);
        return prefix + "/detail";
    }

    /**
     * 删除施工许可证修改记录列
     */
    @RequiresPermissions("supervise:ConsturctionChangeInfoList:remove")
    @Log(title = "施工许可证修改记录列", businessType = BusinessType.DELETE)
    @PostMapping( "/remove")
    @ResponseBody
    public AjaxResult remove(String ids)
    {
        return toAjax(consturctionChangeInfoListService.deleteConsturctionChangeInfoListByIds(ids));
    }
}
